path = None
# Parameters
path = "/var/folders/wf/2fbzf4jd0ls3l98_561qjsxh0000gn/T/flyte-_sgm4nsk/raw/d97c85a1eb457c724c1e6901218ad5eb/tmp05uv7bor"
from dataclasses import asdict
from IPython.display import display
import pandas as pd
from PIL import Image
from methanesat.demos import IMAGES
try:
df = pd.read_parquet(path)
except:
df = pd.DataFrame([asdict(img) for img in IMAGES])
df["correct"] = ((df.prediction > 0.5) == df.label).astype(int)
df.sort_values(by="correct")[["label", "prediction", "description"]]
| label | prediction | description | |
|---|---|---|---|
| 2 | 0.0 | 0.934557 | This image is named img3.png and contains clouds |
| 0 | 1.0 | 0.960024 | This image is named img1.png and contains meth... |
| 1 | 1.0 | 0.933431 | This image is named img2.png and contains meth... |
accuracy = df["correct"].sum() / len(df)
print(f"accuracy = {accuracy}")
accuracy = 0.6666666666666666
for i, img in enumerate(IMAGES):
if (img.prediction > 0.5) == 1 and img.label == 0.0:
print(f"Image {i}")
display(Image.open(img.file.download()))
Image 2
for i, img in enumerate(IMAGES):
if (img.prediction > 0.5) == img.label:
print(f"Image {i}")
display(Image.open(img.file.download()))
Image 0
Image 1